<%@ page language="java" import="java.util.*" pageEncoding="utf-8"
	isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    String path = request.getContextPath();
			String basePath = request.getScheme() + "://"
					+ request.getServerName() + ":" + request.getServerPort()
					+ path + "/";
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="<%=request.getContextPath()%>/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/select.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.idTabs.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/select-ui.min.js"></script>
<script type="text/javascript">
	function chongzhi(a){
		var value=$(a).val();
		var re = /^((0(\.\d{0,2})?)|([1-9]{1}[0-9]{0,9}(\.\d{0,1})?))$/;
		if(!re.test(value)){
			$(a).val(    	value.substring(0,value.length-1));
		}
	}
	function chongzhia(a){
		var value=$(a).val();
		var re = /^((0(\.\d{0,2})?)|([1-9]{1}[0-9]{0,9}(\.\d{0,2})?))$/;
		if(!re.test(value)){
			$(a).val(    	value.substring(0,value.length-1));
		}
	}
</script>
</head>

<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><e>首页</e></li>
    <li><e>财务管理</e></li>
    <li><e>提成设置</e></li>                                        
    </ul>
    </div>
    
    <div class="formbody">
    
    
    <div id="usual1" class="usual"> 
    
    <div class="itab">
  	<ul> 
    <li><a href="#tab1" class="selected" style="font-size:15">提成设置</a></li> 
    
  	</ul>
    </div> 
    
  	<div id="tab1" class="tabson">
    <ul class="forminfo">
<%--     <li>普通用户&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	企业一级提成：折后成交额：<input onchange="chongzhi(this)" name="wu4" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.ordinary_ent_level} "/>%
   
    </li>
    <li>Vip用户&nbsp;&nbsp;&nbsp;
    	企业一级提成：折后成交额：<input onchange="chongzhi(this)" name="wu1" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.vip_ent_level} "/>%
    </li> --%>
    <li>普通用户&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   		 一级提成：交成额：<input onkeyup="chongzhi(this)" name="shi3" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.ordinary_one_level}"/>%
    	二级提成：交成额：<input onkeyup="chongzhi(this)" name="shi5" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.ordinary_two_level}"/>%
   
    </li>
    <li>Vip1用户&nbsp;&nbsp;&nbsp;
    	一级提成：交成额：<input onkeyup="chongzhi(this)" name="shi1" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.vip_one_level}"/>%
    	二级提成：交成额：<input onkeyup="chongzhi(this)" name="shi2" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.vip_two_level}"/>%
    </li>
    <li>Vip2用户&nbsp;&nbsp;&nbsp;
    	一级提成：交成额：<input onkeyup="chongzhi(this)" name="shi6" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.two_vip_one}"/>%
    	二级提成：交成额：<input onkeyup="chongzhi(this)" name="shi4" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.two_vip_two}"/>%
    </li>
        <li>企业VIP用户交易提成：&nbsp;&nbsp;&nbsp;
    	<input onkeyup="chongzhi(this)" name="ershii" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.ent_pay}"/>%
    </li>
    <li>VIP1用户服务费折扣：&nbsp;&nbsp;&nbsp;
    	<input onkeyup="chongzhi(this)" name="ershi" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.vip_discount}"/>%
    VIP1用户消费折扣：&nbsp;&nbsp;&nbsp;
    	<input onkeyup="chongzhi(this)" name="wushi" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.vip_user_discount}"/>%
    </li>
    <li> VIP2用户服务费折扣：&nbsp;&nbsp;&nbsp;
    	<input onkeyup="chongzhi(this)" name="ershi1" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.two_vip_discount}"/>%
    VIP2用户消费折扣：&nbsp;&nbsp;&nbsp;
    	<input onkeyup="chongzhi(this)" name="wushi2" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.two_user_discount}"/>%
       </li>
    <li>企业用户服务费折扣：&nbsp;
    	<input onkeyup="chongzhi(this)" name="yibai" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.ent_user_discount}"/>%
    </li>
    <li>个人VIP1会员推荐VIP1会员提成：&nbsp;
    	<input onkeyup="chongzhia(this)" name="yibai2" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.vip_recommend_one}"/>元
    </li>
    <li>个人VIP1会员推荐企业VIP会员提成:&nbsp;
    	<input onkeyup="chongzhia(this)" name="yibai3" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.vip_recommend_ent}"/>元
    </li>
    <li>个人VIP2会员推荐VIP1会员提成：&nbsp;
    	<input onkeyup="chongzhia(this)" name="yibai4" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.twovip_recommend_one}"/>元
    </li>
    <li>个人VIP2会员推荐VIP2会员提成：&nbsp;
    	<input onkeyup="chongzhia(this)" name="yibai5" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.twovip_recommend_two}"/>元
    </li>
    <li>个人VIP2会员推荐企业VIP会员提成：&nbsp;
    	<input onkeyup="chongzhia(this)" name="yibai6" type="text" class="dfinput" style="width:40px;height:20px;" value="${lists.twovip_recommend_ent}"/>元
    </li>
    </ul>
    <div style="margin-left:50px;"><input name="" type="button" class="tijiao" value="提交" style="width:96px; height:35px; line-height:35px; color:#fff; background:red; font-size:14px; font-weight:bold;border-radius: 3px; cursor:pointer;"/>
    </div> 
  </div>
  <script type="text/javascript">
  	$(function(){
  		$(".tijiao").click(function(){
  	/* 		var vip_ent_level = $("input[name=wu1]").val(); */
  			var vip_one_level = $("input[name=shi1]").val();
  			var vip_two_level = $("input[name=shi2]").val();
  			var two_vip_one = $("input[name=shi6]").val();
  			var two_vip_two = $("input[name=shi4]").val();
  			var ent_pay = $("input[name=ershii]").val();
  /* 			var ordinary_ent_level = $("input[name=wu4]").val(); */
  			var ordinary_two_level = $("input[name=shi5]").val();
  			var ordinary_one_level = $("input[name=shi3]").val();
  			var vip_discount = $("input[name=ershi]").val();
  			var vip_user_discount = $("input[name=wushi]").val();
  			var two_vip_discount = $("input[name=ershi1]").val();
  			var two_user_discount = $("input[name=wushi2]").val();
  			var ent_user_discount = $("input[name=yibai]").val();
  			
  			var vip_recommend_one = $("input[name=yibai2]").val();
  			var vip_recommend_ent = $("input[name=yibai3]").val();
  			var twovip_recommend_one = $("input[name=yibai4]").val();
  			var twovip_recommend_two = $("input[name=yibai5]").val();
  			var twovip_recommend_ent = $("input[name=yibai6]").val();
  			if( ordinary_two_level == "" || vip_one_level == "" || vip_two_level == "" || vip_discount == ""|| vip_user_discount == "" || ent_user_discount == ""
  				||  ordinary_one_level == ""		){
  				alert("请先设置折扣");
  				return;
  			}
  			$.ajax({
  				type:"get",
  				url:"<%=request.getContextPath()%>/updateRoyalty", 
  				data:{
  					ordinary_two_level:ordinary_two_level,
  					ordinary_one_level:ordinary_one_level,
  					vip_one_level:vip_one_level,
  					vip_two_level:vip_two_level,
  					vip_discount:vip_discount,
  					vip_user_discount:vip_user_discount,
  					ent_user_discount:ent_user_discount,
  					two_vip_one:two_vip_one,
  					two_vip_two:two_vip_two,
  					ent_pay:ent_pay,
  					two_vip_discount:two_vip_discount,
  					two_user_discount:two_user_discount,
  					vip_recommend_one:vip_recommend_one,
  					vip_recommend_ent:vip_recommend_ent,
  					twovip_recommend_one:twovip_recommend_one,
  					twovip_recommend_two:twovip_recommend_two,
  					twovip_recommend_ent:twovip_recommend_ent,
  					id:'${lists.id}'
  				},
  				dataType:"json",
  				success:function(data){
  					if(data.flag > 0){
  					 	var btn = confirm("提交成功!")
		   				window.location.href="<%=request.getContextPath()%>/royalty";
  					}
  				}
			}) 
  		})
  	})
  </script>
</body>
</html>
